import { GTextFormat } from "../../common/GTextFormat";
import { FontUtil } from "../../common/font/FontUtil";
import { FilterConst } from "../../component/gconst/FilterConst";
import { LayerManager } from "./LayerManager";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
import { TweenMax } from "../../../com/greensock/TweenMax";
import { Quint } from "../../../com/greensock/easing/Quint";
import { Global } from "../../../com/gengine/global/Global";
//class MsgFloatWordImpl
    
    export  class MsgFloatWordImpl
    {
        

        public showWord(arg1: string): void
        {
            this.dispose();
            if (!this._wordTxt) 
            {
                this._wordTxt = new Object /* flash.text.TextField */();
                this._wordTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
                this._wordTxt.defaultTextFormat = new GTextFormat(FontUtil.xingkaiName, 36, 16760832, null, null, null, null, flash.text.TextFormatAlign.CENTER);
                this._wordTxt.filters = [FilterConst.nameGlowFilter];
                this._wordTxt.selectable = false;
                this._wordTxt.mouseEnabled = false;
                this._wordTxt.width = 1000;
                this._wordTxt.height = 100;
            }
            if (this._wordTxt.parent == null) 
            {
                LayerManager.msgTipLayer.addChild(this._wordTxt);
            }
            this._wordTxt.htmlText = HTMLUtil.addColor(arg1, "#ffc000");
            this._wordTxt.alpha = 0;
            this._tweenIn = TweenMax.to(this._wordTxt, 1, {"alpha": 1, "ease": Quint.easeIn});
            this.stageResize();
            return;
        }

        public dispose(): void
        {
            if (this._tweenIn && this._tweenIn.active) 
            {
                this._tweenIn.kill();
            }
            if (this._wordTxt) 
            {
                this._wordTxt.text = "";
                if (this._wordTxt.parent) 
                {
                    this._wordTxt.parent.removeChild(this._wordTxt);
                }
            }
            return;
        }

        public stageResize(): void
        {
            if (this._wordTxt && this._wordTxt.parent) 
            {
                this._wordTxt.x = (Global.stage.stageWidth - this._wordTxt.textWidth) / 2;
                this._wordTxt.y = (Global.stage.stageHeight - this._wordTxt.textHeight) / 2 - 50;
            }
            return;
        }

        /* internal */ /* var */_wordTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_tweenIn: TweenMax;
    }
